Skip to content

Todo 表示の session.todo() API 移行#23

Merged
ktmage merged 1 commit into
developmentfrom
feature/15/migrate-todo-to-session-api
Feb 28, 2026
Merged

Todo 表示の session.todo() API 移行#23
ktmage merged 1 commit into
developmentfrom
feature/15/migrate-todo-to-session-api

Conversation

@ktmage

@ktmage ktmage commented Feb 28, 2026

Copy link
Copy Markdown
Owner

概要

Todo 表示のデータソースを、メッセージストリームからの todowrite/todoread ツールパート逆順パースから、専用の session.todo() SDK API + todo.updated SSE イベントに移行する。

Closes #15

背景

従来は useMessages フック内で全メッセージを末尾から走査し、todowrite/todoread ツールパートの出力を parseTodos() でパースして Todo リストを導出していた。session.todo() API はセッションの Todo リストを直接取得する専用エンドポイントであり、パースロジックを回避してより信頼性の高い方法で Todo を取得できる。

変更内容

Extension Host 側

  • opencode-client.ts: Todo 型の re-export、getSessionTodos() メソッド追加
  • chat-view-provider.ts: getSessionTodos / sessionTodos メッセージプロトコル追加

Webview 側

  • vscode-api.ts: sessionTodos (Ext→Webview) / getSessionTodos (Webview→Ext) メッセージ型追加
  • App.tsx: todos state 追加、todo.updated SSE イベントハンドリング、セッション切替時の Todo フェッチ
  • useMessages.ts: latestTodos の useMemo 導出ロジックと parseTodos import を削除
  • AppContext.tsx: latestTodos の型を TodoItem → SDK Todo に変更
  • TodoHeader.tsx: Props 型を SDK Todo に変更

テスト

  • 11-todo.test.tsx: sessionTodos メッセージと todo.updated SSE イベントベースのテストに書き換え。セッション切替クリア・別セッション無視・activeSession 再送時の維持テストを追加
  • useMessages.test.ts: 削除された latestTodos 関連テスト 2 件を除去

後方互換性

  • TodoView(ツールパート内のインライン表示)と parseTodos ユーティリティは変更なし

チェックリスト

  • npm run build パス
  • npm test パス(52 ファイル / 710 テスト)
  • Biome lint エラー 0

…#15)

- Add getSessionTodos() method to OpenCodeConnection
- Add sessionTodos / getSessionTodos message protocol
- Handle todo.updated SSE event for real-time updates
- Remove latestTodos derivation from useMessages hook
- Update TodoHeader and AppContext to use SDK Todo type
- Fetch todos on session activation, clear on session deselect
- Update scenario tests for new API-based Todo flow
@ktmage ktmage changed the title feat: migrate Todo display from message parsing to session.todo() API (#15) Todo 表示の session.todo() API 移行 Feb 28, 2026
@ktmage ktmage linked an issue Feb 28, 2026 that may be closed by this pull request
@ktmage ktmage marked this pull request as ready for review February 28, 2026 18:50
@ktmage ktmage merged commit 7e0e0f6 into development Feb 28, 2026
1 check passed
@ktmage ktmage deleted the feature/15/migrate-todo-to-session-api branch March 1, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Todo 表示の session.todo() API 移行

1 participant